<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8" />
		<title>4.数学的方法</title>
	</head>
	<body>
		<script type="text/javascript" >
			let todos = [
				{id:'g76tyds76d',title:'吃饭',done:true},
				{id:'9i8u9sadou',title:'睡觉',done:false},
				{id:'oi7y87h898',title:'学习',done:true}
			]

			let id = 'g76tyds76d'

			//使用filter实现，效率不是很高
			/* const x = todos.filter((t)=>{
				console.log('@')
				return t.id !== id
			})
			console.log(x) */

			//使用findIndex配合splice实现，效率不是很高
			/* const x = todos.findIndex((t)=>{
				console.log('@')
				return t.id === id
			})
			console.log(x)
			todos.splice(x,1) */
			


		</script>
	</body>
</html>